(() => {
  //---------- 计算两个日期之间的天数差 ----------
  function getDaysBetweenDates(date1:string, date2:string):number {
    const startDate = new Date(date1);
    const endDate = new Date(date2);
    const timeDifference:number = endDate.getTime() - startDate.getTime();
    const daysDifference:number = timeDifference / (1000 * 3600 * 24);

    return Math.abs(Math.ceil(daysDifference));
  }

  // 示例用法
  console.log(getDaysBetweenDates('2024-08-01', '2024-08-14')); // 输出: 13
})()